#ifndef STOPWATCHWIDGET_H
#define STOPWATCHWIDGET_H

#include <QWidget>
#include <QPainter>
#include <QDebug>
#include <QtMath>
#include <QDialog>
#include <QPainter>
#include <QPaintEvent>
#include <QPainterPath>
#include <QRadialGradient>

#include <QTimer>
#include <QKeyEvent>

class StopWatchWidget : public QWidget
{
    Q_OBJECT
public:
     StopWatchWidget(QWidget *parent = nullptr);
        ~StopWatchWidget();

     QWidget *baseWidget;
     QTimer *myTimer;


     int radius;//仪表盘的中心位置
     int direction;//指针运动的方向,1为前进，0为后退
 protected:
     void paintEvent(QPaintEvent*);
 private:
     int degRotate =0;
private:
    void setUI();
    void DrawPoint(QPainter&,int);
    void DrawDigital(QPainter&,int);
    void DrawSmallScale(QPainter&,int);
    void DrawBigScale(QPainter&,int);
    void DrawUnit(QPainter&,int);
    void DrawNum(QPainter&,int);
    void DrawPointer(QPainter&,int);
    void drawIndicator(QPainter *painter);
    void keyPressEvent(QKeyEvent *event);
    void keyReleaseEvent(QKeyEvent *event);
private slots:
    void slot_speed_changed();
signals:

};

#endif // STOPWATCHWIDGET_H
